/*
 * $Id: CreateRFSRequest.java,v 1.8 2012/04/24 01:28:04 navdeep_mahajan Exp $
 * 
 * Copyright (C) 2010 General Electric Company. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of the General
 * Electric Company (GE). You shall not disclose this software and shall use it
 * only in accordance with the terms of the license agreement you entered into
 * with GE.
 * 
 * GE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
 * NON-INFRINGEMENT. GE SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 * AS A RESULT OF USING, MODIFYING, OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package com.ge.healthcare.autosc.createrfs.request;

import com.ge.healthcare.autosc.common.ASCUtil;
import com.ge.med.service.eds.system.vo.AssetInformation;

/**
 * Message sent to create a CAPS/CARES RFS and an Assist Case for an alert that
 * was generated for a system.
 * 
 */
public class CreateRFSRequest {

	/** The system ID for which the alert was generated. */
	private String systemid = null;

	/** Symptom of the problem that caused the alert. */
	private String symptom1 = null;

	/** Secondary symptom of the problem that caused the alert. */
	private String symptom2 = null;

	// private String symptom = null;

	/** Equipment status date */
	private String equipmentStatusDate = null;

	private String symptom2WithValueRemoved;

	/** Alert Value */
	private String value = null;

	/** The first 6 characters of the system ID */
	private String shortSystemid;

	private String pole = null;

	/** Siebel's Asset Info */
	private AssetInformation assetInfo = null;

	/**
	 * Getter for the system ID. Should not be null.
	 * 
	 * @return
	 */
	public String getSystemid() {
		return systemid;
	}

	/**
	 * Getter for the short system ID
	 * 
	 * @return fist 6 characters of the full system ID
	 */
	public String getShortSystemId() {
		return shortSystemid;
	}

	/**
	 * Get the value associated with the alert.
	 * 
	 * @return alert value
	 * 
	 */
	public String getValue() {
		return value;
	}

	/**
	 * Setter for the system ID. For CAPS and Assist, the system ID should not
	 * be greater than 6 characters so truncate.
	 * 
	 * @param systemid
	 */
	public void setSystemid(String sysid) {

		systemid = sysid;

		if (!ASCUtil.isNullOrEmpty(sysid) && sysid.trim().length() > 6) {
			shortSystemid = sysid.substring(0, 6);
		} else {
			shortSystemid = sysid;
		}
	}

	/**
	 * Getter for the primary symptom of the alert that the RFS is being
	 * generated for.
	 * 
	 * @return
	 */
	public String getSymptom1() {
		return symptom1;
	}

	/**
	 * Setter for the primary symptom.
	 * 
	 * @param symptom1
	 */
	public void setSymptom1(String sym1) {
		symptom1 = sym1;
	}

	/**
	 * Getter for the secondary symptom of the alert that the RFS is being
	 * generated for.
	 * 
	 * @return
	 */
	public String getSymptom2() {
		return symptom2;
	}

	/**
	 * The last token in symptom2 is a value. This method will return the
	 * symptom with the value removed.
	 * 
	 * @return
	 */
	public String getSymptom2WithValueRemoved() {
		return symptom2WithValueRemoved;
	}

	/**
	 * Setter for the secondary symptom.
	 * 
	 * @param symptom2
	 */
	public void setSymptom2(String sym2) {
		symptom2 = sym2;
		symptom2WithValueRemoved = sym2;
		value = "";
		if (!ASCUtil.isNullOrEmpty(sym2) && sym2.length() > 0) {
			int li = sym2.trim().lastIndexOf(' ');
			if (li > 0) {
				symptom2WithValueRemoved = sym2.trim().substring(0, li).trim();
				value = sym2.trim().substring(li).trim();
			}
		}
	}

	/*
	 * public String getSymptom() { return symptom; }
	 * 
	 * public void setSymptom(String symptom) { this.symptom = symptom; }
	 */

	/**
	 * Getter for the equipment status date.
	 * 
	 * @return
	 */
	public String getEquipmentStatusDate() {
		return equipmentStatusDate;
	}

	/**
	 * Setter for the equipment status date.
	 * 
	 * @param equipmentStatusDate
	 */
	public void setEquipmentStatusDate(String equipmentStatusDate) {
		this.equipmentStatusDate = equipmentStatusDate;
	}

	public void setPole(String pole) {
		this.pole = pole;
	}

	public String getPole() {
		return pole;
	}

	/**
	 * @return the assetInfo
	 */
	public AssetInformation getAssetInfo() {
		return assetInfo;
	}

	/**
	 * @param assetInfo
	 *            the assetInfo to set
	 */
	public void setAssetInfo(AssetInformation assetInfo) {
		this.assetInfo = assetInfo;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "CreateRFSRequest [systemid=" + systemid + ", symptom1="
				+ symptom1 + ", symptom2=" + symptom2
				+ ", equipmentStatusDate=" + equipmentStatusDate
				+ ", symptom2WithValueRemoved=" + symptom2WithValueRemoved
				+ ", value=" + value + ", shortSystemid=" + shortSystemid
				+ ", pole=" + pole + ", assetInfo=" + assetInfo + "]";
	}

}
